<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="txt1">+
    <input type="text" id="txt2">=
    <input type="text" id="txt3">
    <button id="btn">计算</button>
</body>
</html>
<script>
    const txt1 = document.querySelector('#txt1')
    const txt2 = document.querySelector('#txt2')
    const txt3 = document.querySelector('#txt3')
    const btn = document.querySelector('#btn')
    btn.onclick = function (){
        txt3.value = +txt1.value + +txt2.value
    }
</script>